package com.noble.meether.ui.diamond.bean;

import com.noble.library.base.bean.BaseData;
import com.noble.library.utils.StringUtils;

import org.json.JSONObject;

/**
 * 钻石充值列表
 */
public class Diamond extends BaseData {
    // 充值列表
    private int id;
    private int doPay;              // 钻石数量
    private double amount;          // 充值金额
    private int isNew;              // 是否为新手包 1: 是  0： 不是

    // 账单明细
    private String typePayName;     // 明细描述
    private int typePay;            // 类型 < 0: 消费，-(dopay+dogive);   > 0: 增加 +(dopay+dogive)
    private int doGive;             // 赠送数量
    private String timeCreate;      // 记录时间

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);
        this.setId(jsonObject.optInt("Id"));
        this.setDoPay(jsonObject.optInt("DoPay"));
        this.setAmount(jsonObject.optDouble("Amount"));
        this.setIsNew(jsonObject.optInt("IsNew"));

        this.setTypePayName(jsonObject.optString("TypePayName"));
        this.setTypePay(jsonObject.optInt("TypePay"));
        this.setDoGive(jsonObject.optInt("DoGive"));
        this.setTimeCreate(jsonObject.optString("TimeCreate"));
    }

    /**
     * @return 是否为新手包
     */
    public boolean isNew() {
        return getIsNew() == 1;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getDoPay() {
        return doPay;
    }

    public void setDoPay(int doPay) {
        this.doPay = doPay;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public int getIsNew() {
        return isNew;
    }

    public void setIsNew(int isNew) {
        this.isNew = isNew;
    }

    public int getTypePay() {
        return typePay;
    }

    public void setTypePay(int typePay) {
        this.typePay = typePay;
    }

    public int getDoGive() {
        return doGive;
    }

    public void setDoGive(int doGive) {
        this.doGive = doGive;
    }

    public String getTimeCreate() {
        return StringUtils.getCreateTime(timeCreate);
    }

    public void setTimeCreate(String timeCreate) {
        this.timeCreate = timeCreate;
    }

    public String getTypePayName() {
        return typePayName;
    }

    public void setTypePayName(String typePayName) {
        this.typePayName = typePayName;
    }
}
